From: Anthony PERARD Date: Fri, 15 Nov 2019 16:15:32 +0000 (+0000) Subject: configure: Fix test for python 3.8 X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~1164 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=0d2791b007436f83cc8cb922acb1849a3ff31f3a;p=xen.git configure: Fix test for python 3.8 https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build > To embed Python into an application, a new --embed option must be > passed to python3-config --libs --embed to get -lpython3.8 (link the > application to libpython). To support both 3.8 and older, try > python3-config --libs --embed first and fallback to python3-config > --libs (without --embed) if the previous command fails. Signed-off-by: Anthony PERARD Acked-by: Wei Liu [ wei: rerun autogen.sh ] --- diff --git a/m4/python_devel.m4 b/m4/python_devel.m4 index e365cd658e..bbf1e0354b 100644 --- a/m4/python_devel.m4 +++ b/m4/python_devel.m4 @@ -23,8 +23,15 @@ AS_IF([test x"$pyconfig" = x"no"], [ ], [ dnl If python-config is found use it CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`" - LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`" - LIBS="$LIBS `$PYTHON-config --libs`" + dnl We need to use --embed with python 3.8 but not with earlier version so + dnl check if it is recognized. + python_devel_embed="" + if $PYTHON-config --embed >/dev/null 2>/dev/null; then + python_devel_embed="--embed" + fi + LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags $python_devel_embed`" + LIBS="$LIBS `$PYTHON-config --libs $python_devel_embed`" + unset python_devel_embed ]) AC_CHECK_HEADER([Python.h], [], diff --git a/tools/configure b/tools/configure index d9ccce6d2b..e47bcef351 100755 --- a/tools/configure +++ b/tools/configure @@ -7460,8 +7460,13 @@ if test x"$pyconfig" = x"no"; then : else CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`" - LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`" - LIBS="$LIBS `$PYTHON-config --libs`" + python_devel_embed="" + if $PYTHON-config --embed >/dev/null 2>/dev/null; then + python_devel_embed="--embed" + fi + LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags $python_devel_embed`" + LIBS="$LIBS `$PYTHON-config --libs $python_devel_embed`" + unset python_devel_embed fi